var Promise  = require('bluebird');
var BankList    = require('../models/bankList');
var using = Promise.using;

function getQuerySupportBankList(type){
  return BankList.querySupportBankList(type, 'aaa', '127.0.0.1')
    .then(function(result){
      if(typeof result !== 'object') result = JSON.parse(result)
      if(result && result.body){
        result = result.body;
        if(typeof result !== 'object') result = JSON.parse(result)
        return result; 
      }else{
        return {}
      }
    })
    .catch(function(err){
      return {}
    })
}


module.exports ={
  detail : function(type, cb){
    return using(
      getQuerySupportBankList(type),
      cb
    )
  }
}